package com.ikkong.biz.excel;

import com.ikkong.biz.model.Classes;
import com.jfinal.kit.StrKit;
import org.jeecgframework.poi.excel.entity.result.ExcelVerifyHanlderResult;
import org.jeecgframework.poi.handler.inter.IExcelVerifyHandler;

/**
 * Created by linyu on 2016/11/14.
 */
public class ExcelClassesVerifyHandlerImpl implements IExcelVerifyHandler<Classes>{

    @Override
    public ExcelVerifyHanlderResult verifyHandler(Classes classes) {
        StringBuilder builder = new StringBuilder();
        if (StrKit.isBlank(classes.getClass_name())) {
            builder.append("班级名称不能为空");
        }
        if (null == classes.getGrade_id()){
            builder.append("年级不能为空");
        }else {
            if (classes.getGrade_id().intValue()>3 || classes.getGrade_id().intValue()<1){
                builder.append("年级必须为1－3");
            }
        }
        return new ExcelVerifyHanlderResult(false, builder.toString());
    }
}
